package jyan.sango.crazy.core.xml;

import java.io.File;
import java.util.Iterator;
import java.util.List;

import jyan.sango.crazy.core.debug.DEBUG;
import jyan.sango.crazy.core.debug.SangoException;
import jyan.sango.crazy.core.player.Sex;

import org.dom4j.Element;

public class ReadSkill {
	// 配置文件名
	private static final String fileskill = "skill.xml";

	private static File getSkillFile(final String filename) {
		String tmpfilename = null;

		if (filename != null) {
			tmpfilename = filename;
		} else {
			tmpfilename = fileskill;
		}
		File f = new File(tmpfilename);
		return f;
	}

	public static void getSkillsWithFileName(String filename) throws SangoException {

		List<?> list = ReadFile.getElementList(getSkillFile(filename));
		Element data;

		data = (Element) list.get(0);

		DEBUG.Print(list.toString());
		String str = null;

		Iterator<?> subitr = data.elementIterator();
		DEBUG.Print(data.attribute("index").getName());
		DEBUG.Print(data.attribute("index").getText());
		while (subitr.hasNext()) {
			data = (Element) subitr.next();
			str = data.getName();
			DEBUG.Print(str);
			str = data.getText();
			DEBUG.Print(str);
			DEBUG.Print(Sex.Male.toString());
		}

	}

}
